<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>leon</title>
</head>

<body>

</body>
<script>
  // 通过循环 在页面中打印100以内所有偶数的和
  let sum = 0;

  // for (let i = 0; i <= 100; i++) {
  //   if (i % 2 === 0) {
  //     sum += i;
  //   }
  // }

  for (let i = 2; i <= 100; i += 2) {
    sum += i;
  }

  console.log(sum);
</script>

</html>